var PORT = 3000;

//Http request
var express  = require('express');
var app = express();
var url=require('url');
var fs=require('fs');
var mine=require('./server/mine').types;
var path=require('path');
var session = require('express-session');


console.log(123);
//MongoDB connect
var mongodb=require('./server/db');
//var mongodb=require('./server/db');
console.log(1123);
//静态文件
app.use('/',express.static('pages'));
app.use('/',express.static('public'));
var bodyParser = require('body-parser');
app.use(bodyParser.json()); // for parsing application/json
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded


//请求
require('./server/rounter').server(app,session);
//监听server
var http = require('http').Server(app);
http.listen(PORT, function(req,res){
  console.log();
  console.log('listening on *:3000');
});
require('./server/io').ioListen(http);

console.log("Server runing at port: " + PORT + ".");